%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Time evolution of a simple matrix.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear;

H =[1 1 1											%Hamiltonian ( hbar=1 )
	1 1 1
	1 1 1];

psi0=[	1											%initial state
		0
		0];

t=[0:.02:5];										%time

for tt=1:length(t)
	psi=expm(-i*H*t(tt))*psi0;						%solution of Schrödinger equation
	Psi1(tt)=psi(1);
	Psi2(tt)=psi(2);
	Psi3(tt)=psi(3);
end

figure(1);		clf;
plot(t,abs(Psi1).^2,'r',t,abs(Psi2).^2,'+g',t,abs(Psi3).^2,'b')
set(gca,'xLim',[0 5],'yLim',[0 1],'FontSize',20)
xlabel('\fontsize{20}{\itt}   (s)')
ylabel('\fontsize{20}|1\rangle , |2\rangle , |3\rangle')

		